import request from '../utils/request'

export interface reqSearchData {
    data: {
        data: {
            defaultKeyword: {},
            defaultKeywords: any[],
            hotKeywordVOList: any[]
        }
    }
}

export const getSearch = () => {
    return request.get<any, reqSearchData>('xhr/search/init.json')
}


// https://m.you.163.com/xhr/search/searchAutoComplete.json
// post
export const searchWord = (keywordPrefix:string) => {
    return request.post(`xhr/search/searchAutoComplete.json?keywordPrefix=${keywordPrefix}`)
}

// 获取搜索列表数据
export const goodsList = (word:string) => {
    return request.get(`/xhr/search/search.json?__timestamp=1630133434953&needPopWindow=true&searchWordSource=7&stillSearch=false&_stat_search=autoComplete&itemId=0&size=40&upperPrice=-1&floorPrice=-1&matchType=0&categoryId=0&descSorted=false&sortType=0&keyword=${word}`)
}